3.3.50 \(\int (a+b \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx\) [250]

3.3.50.1 Optimal result
3.3.50.2 Mathematica [C] (verified)
3.3.50.3 Rubi [A] (verified)
3.3.50.4 Maple [A] (verified)
3.3.50.5 Fricas [A] (verification not implemented)
3.3.50.6 Sympy [A] (verification not implemented)
3.3.50.7 Maxima [A] (verification not implemented)
3.3.50.8 Giac [B] (verification not implemented)
3.3.50.9 Mupad [B] (verification not implemented)

3.3.50.1 Optimal result

Integrand size = 23, antiderivative size = 140 \[ \int (a+b \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\left (a^3 A-3 a A b^2-3 a^2 b B+b^3 B\right ) x-\frac {\left (3 a^2 A b-A b^3+a^3 B-3 a b^2 B\right ) \log (\cos (c+d x))}{d}+\frac {b \left (2 a A b+a^2 B-b^2 B\right ) \tan (c+d x)}{d}+\frac {(A b+a B) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d} \]

output
(A*a^3-3*A*a*b^2-3*B*a^2*b+B*b^3)*x-(3*A*a^2*b-A*b^3+B*a^3-3*B*a*b^2)*ln(c 
os(d*x+c))/d+b*(2*A*a*b+B*a^2-B*b^2)*tan(d*x+c)/d+1/2*(A*b+B*a)*(a+b*tan(d 
*x+c))^2/d+1/3*B*(a+b*tan(d*x+c))^3/d
 
3.3.50.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 1.04 (sec) , antiderivative size = 130, normalized size of antiderivative = 0.93 \[ \int (a+b \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {3 (a+i b)^3 (-i A+B) \log (i-\tan (c+d x))+3 (a-i b)^3 (i A+B) \log (i+\tan (c+d x))+6 b \left (3 a A b+3 a^2 B-b^2 B\right ) \tan (c+d x)+3 b^2 (A b+3 a B) \tan ^2(c+d x)+2 b^3 B \tan ^3(c+d x)}{6 d} \]

input
Integrate[(a + b*Tan[c + d*x])^3*(A + B*Tan[c + d*x]),x]
 
output
(3*(a + I*b)^3*((-I)*A + B)*Log[I - Tan[c + d*x]] + 3*(a - I*b)^3*(I*A + B 
)*Log[I + Tan[c + d*x]] + 6*b*(3*a*A*b + 3*a^2*B - b^2*B)*Tan[c + d*x] + 3 
*b^2*(A*b + 3*a*B)*Tan[c + d*x]^2 + 2*b^3*B*Tan[c + d*x]^3)/(6*d)
 
3.3.50.3 Rubi [A] (verified)

Time = 0.59 (sec) , antiderivative size = 140, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.348, Rules used = {3042, 4011, 3042, 4011, 3042, 4008, 3042, 3956}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a+b \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (c+d x))^3 (A+B \tan (c+d x))dx\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (a+b \tan (c+d x))^2 (a A-b B+(A b+a B) \tan (c+d x))dx+\frac {B (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (c+d x))^2 (a A-b B+(A b+a B) \tan (c+d x))dx+\frac {B (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (a+b \tan (c+d x)) \left (A a^2-2 b B a-A b^2+\left (B a^2+2 A b a-b^2 B\right ) \tan (c+d x)\right )dx+\frac {(a B+A b) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (c+d x)) \left (A a^2-2 b B a-A b^2+\left (B a^2+2 A b a-b^2 B\right ) \tan (c+d x)\right )dx+\frac {(a B+A b) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 4008

\(\displaystyle \left (a^3 B+3 a^2 A b-3 a b^2 B-A b^3\right ) \int \tan (c+d x)dx+\frac {b \left (a^2 B+2 a A b-b^2 B\right ) \tan (c+d x)}{d}+x \left (a^3 A-3 a^2 b B-3 a A b^2+b^3 B\right )+\frac {(a B+A b) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \left (a^3 B+3 a^2 A b-3 a b^2 B-A b^3\right ) \int \tan (c+d x)dx+\frac {b \left (a^2 B+2 a A b-b^2 B\right ) \tan (c+d x)}{d}+x \left (a^3 A-3 a^2 b B-3 a A b^2+b^3 B\right )+\frac {(a B+A b) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {b \left (a^2 B+2 a A b-b^2 B\right ) \tan (c+d x)}{d}-\frac {\left (a^3 B+3 a^2 A b-3 a b^2 B-A b^3\right ) \log (\cos (c+d x))}{d}+x \left (a^3 A-3 a^2 b B-3 a A b^2+b^3 B\right )+\frac {(a B+A b) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d}\)

input
Int[(a + b*Tan[c + d*x])^3*(A + B*Tan[c + d*x]),x]
 
output
(a^3*A - 3*a*A*b^2 - 3*a^2*b*B + b^3*B)*x - ((3*a^2*A*b - A*b^3 + a^3*B - 
3*a*b^2*B)*Log[Cos[c + d*x]])/d + (b*(2*a*A*b + a^2*B - b^2*B)*Tan[c + d*x 
])/d + ((A*b + a*B)*(a + b*Tan[c + d*x])^2)/(2*d) + (B*(a + b*Tan[c + d*x] 
)^3)/(3*d)
 

3.3.50.3.1 Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4008
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(a*c - b*d)*x, x] + (Simp[b*d*(Tan[e + f*x]/f), 
x] + Simp[(b*c + a*d)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e, 
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
 

rule 4011
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Int 
[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x], x] 
, x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 
 0] && GtQ[m, 0]
 
3.3.50.4 Maple [A] (verified)

Time = 0.07 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.01

method result size
norman \(\left (A \,a^{3}-3 A a \,b^{2}-3 B \,a^{2} b +B \,b^{3}\right ) x +\frac {b \left (3 A a b +3 B \,a^{2}-B \,b^{2}\right ) \tan \left (d x +c \right )}{d}+\frac {B \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {b^{2} \left (A b +3 B a \right ) \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {\left (3 A \,a^{2} b -A \,b^{3}+B \,a^{3}-3 B a \,b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) \(141\)
parts \(A \,a^{3} x +\frac {\left (A \,b^{3}+3 B a \,b^{2}\right ) \left (\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}+\frac {\left (3 A a \,b^{2}+3 B \,a^{2} b \right ) \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {\left (3 A \,a^{2} b +B \,a^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {B \,b^{3} \left (\frac {\left (\tan ^{3}\left (d x +c \right )\right )}{3}-\tan \left (d x +c \right )+\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(147\)
derivativedivides \(\frac {\frac {B \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+\frac {A \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {3 B a \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+3 A a \,b^{2} \tan \left (d x +c \right )+3 B \,a^{2} b \tan \left (d x +c \right )-B \,b^{3} \tan \left (d x +c \right )+\frac {\left (3 A \,a^{2} b -A \,b^{3}+B \,a^{3}-3 B a \,b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (A \,a^{3}-3 A a \,b^{2}-3 B \,a^{2} b +B \,b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(159\)
default \(\frac {\frac {B \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+\frac {A \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {3 B a \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+3 A a \,b^{2} \tan \left (d x +c \right )+3 B \,a^{2} b \tan \left (d x +c \right )-B \,b^{3} \tan \left (d x +c \right )+\frac {\left (3 A \,a^{2} b -A \,b^{3}+B \,a^{3}-3 B a \,b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (A \,a^{3}-3 A a \,b^{2}-3 B \,a^{2} b +B \,b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(159\)
parallelrisch \(\frac {2 B \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )+6 A x \,a^{3} d -18 A a \,b^{2} d x +3 A \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )-18 B \,a^{2} b d x +6 B \,b^{3} d x +9 B a \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )+9 A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2} b -3 A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) b^{3}+18 A a \,b^{2} \tan \left (d x +c \right )+3 B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{3}-9 B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a \,b^{2}+18 B \,a^{2} b \tan \left (d x +c \right )-6 B \,b^{3} \tan \left (d x +c \right )}{6 d}\) \(192\)
risch \(A \,a^{3} x -3 A a \,b^{2} x -3 B \,a^{2} b x +B \,b^{3} x +3 i A \,a^{2} b x +i B \,a^{3} x -3 i B a \,b^{2} x +\frac {6 i A \,a^{2} b c}{d}-\frac {6 i B a \,b^{2} c}{d}-i A \,b^{3} x +\frac {2 i a^{3} B c}{d}-\frac {2 i A \,b^{3} c}{d}+\frac {2 i b \left (9 A a b \,{\mathrm e}^{4 i \left (d x +c \right )}+9 B \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 B \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-3 i A \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-9 i B a b \,{\mathrm e}^{4 i \left (d x +c \right )}+18 A a b \,{\mathrm e}^{2 i \left (d x +c \right )}+18 B \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 B \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-3 i A \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-9 i B a b \,{\mathrm e}^{2 i \left (d x +c \right )}+9 A a b +9 B \,a^{2}-4 B \,b^{2}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {3 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A \,a^{2} b}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A \,b^{3}}{d}-\frac {a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B a \,b^{2}}{d}\) \(383\)

input
int((a+b*tan(d*x+c))^3*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)
 
output
(A*a^3-3*A*a*b^2-3*B*a^2*b+B*b^3)*x+b*(3*A*a*b+3*B*a^2-B*b^2)/d*tan(d*x+c) 
+1/3*B*b^3/d*tan(d*x+c)^3+1/2*b^2*(A*b+3*B*a)/d*tan(d*x+c)^2+1/2*(3*A*a^2* 
b-A*b^3+B*a^3-3*B*a*b^2)/d*ln(1+tan(d*x+c)^2)
 
3.3.50.5 Fricas [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.01 \[ \int (a+b \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {2 \, B b^{3} \tan \left (d x + c\right )^{3} + 6 \, {\left (A a^{3} - 3 \, B a^{2} b - 3 \, A a b^{2} + B b^{3}\right )} d x + 3 \, {\left (3 \, B a b^{2} + A b^{3}\right )} \tan \left (d x + c\right )^{2} - 3 \, {\left (B a^{3} + 3 \, A a^{2} b - 3 \, B a b^{2} - A b^{3}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (3 \, B a^{2} b + 3 \, A a b^{2} - B b^{3}\right )} \tan \left (d x + c\right )}{6 \, d} \]

input
integrate((a+b*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="fricas")
 
output
1/6*(2*B*b^3*tan(d*x + c)^3 + 6*(A*a^3 - 3*B*a^2*b - 3*A*a*b^2 + B*b^3)*d* 
x + 3*(3*B*a*b^2 + A*b^3)*tan(d*x + c)^2 - 3*(B*a^3 + 3*A*a^2*b - 3*B*a*b^ 
2 - A*b^3)*log(1/(tan(d*x + c)^2 + 1)) + 6*(3*B*a^2*b + 3*A*a*b^2 - B*b^3) 
*tan(d*x + c))/d
 
3.3.50.6 Sympy [A] (verification not implemented)

Time = 0.14 (sec) , antiderivative size = 240, normalized size of antiderivative = 1.71 \[ \int (a+b \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\begin {cases} A a^{3} x + \frac {3 A a^{2} b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 3 A a b^{2} x + \frac {3 A a b^{2} \tan {\left (c + d x \right )}}{d} - \frac {A b^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {A b^{3} \tan ^{2}{\left (c + d x \right )}}{2 d} + \frac {B a^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 3 B a^{2} b x + \frac {3 B a^{2} b \tan {\left (c + d x \right )}}{d} - \frac {3 B a b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {3 B a b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} + B b^{3} x + \frac {B b^{3} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {B b^{3} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\left (c \right )}\right ) \left (a + b \tan {\left (c \right )}\right )^{3} & \text {otherwise} \end {cases} \]

input
integrate((a+b*tan(d*x+c))**3*(A+B*tan(d*x+c)),x)
 
output
Piecewise((A*a**3*x + 3*A*a**2*b*log(tan(c + d*x)**2 + 1)/(2*d) - 3*A*a*b* 
*2*x + 3*A*a*b**2*tan(c + d*x)/d - A*b**3*log(tan(c + d*x)**2 + 1)/(2*d) + 
 A*b**3*tan(c + d*x)**2/(2*d) + B*a**3*log(tan(c + d*x)**2 + 1)/(2*d) - 3* 
B*a**2*b*x + 3*B*a**2*b*tan(c + d*x)/d - 3*B*a*b**2*log(tan(c + d*x)**2 + 
1)/(2*d) + 3*B*a*b**2*tan(c + d*x)**2/(2*d) + B*b**3*x + B*b**3*tan(c + d* 
x)**3/(3*d) - B*b**3*tan(c + d*x)/d, Ne(d, 0)), (x*(A + B*tan(c))*(a + b*t 
an(c))**3, True))
 
3.3.50.7 Maxima [A] (verification not implemented)

Time = 0.33 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.02 \[ \int (a+b \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {2 \, B b^{3} \tan \left (d x + c\right )^{3} + 3 \, {\left (3 \, B a b^{2} + A b^{3}\right )} \tan \left (d x + c\right )^{2} + 6 \, {\left (A a^{3} - 3 \, B a^{2} b - 3 \, A a b^{2} + B b^{3}\right )} {\left (d x + c\right )} + 3 \, {\left (B a^{3} + 3 \, A a^{2} b - 3 \, B a b^{2} - A b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (3 \, B a^{2} b + 3 \, A a b^{2} - B b^{3}\right )} \tan \left (d x + c\right )}{6 \, d} \]

input
integrate((a+b*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="maxima")
 
output
1/6*(2*B*b^3*tan(d*x + c)^3 + 3*(3*B*a*b^2 + A*b^3)*tan(d*x + c)^2 + 6*(A* 
a^3 - 3*B*a^2*b - 3*A*a*b^2 + B*b^3)*(d*x + c) + 3*(B*a^3 + 3*A*a^2*b - 3* 
B*a*b^2 - A*b^3)*log(tan(d*x + c)^2 + 1) + 6*(3*B*a^2*b + 3*A*a*b^2 - B*b^ 
3)*tan(d*x + c))/d
 
3.3.50.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1751 vs. \(2 (136) = 272\).

Time = 1.40 (sec) , antiderivative size = 1751, normalized size of antiderivative = 12.51 \[ \int (a+b \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\text {Too large to display} \]

input
integrate((a+b*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="giac")
 
output
1/6*(6*A*a^3*d*x*tan(d*x)^3*tan(c)^3 - 18*B*a^2*b*d*x*tan(d*x)^3*tan(c)^3 
- 18*A*a*b^2*d*x*tan(d*x)^3*tan(c)^3 + 6*B*b^3*d*x*tan(d*x)^3*tan(c)^3 - 3 
*B*a^3*log(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan 
(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*tan(d*x)^3*tan(c)^3 - 9*A*a^2*b*log(4* 
(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d 
*x)^2 + tan(c)^2 + 1))*tan(d*x)^3*tan(c)^3 + 9*B*a*b^2*log(4*(tan(d*x)^2*t 
an(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c 
)^2 + 1))*tan(d*x)^3*tan(c)^3 + 3*A*b^3*log(4*(tan(d*x)^2*tan(c)^2 - 2*tan 
(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*tan(d 
*x)^3*tan(c)^3 - 18*A*a^3*d*x*tan(d*x)^2*tan(c)^2 + 54*B*a^2*b*d*x*tan(d*x 
)^2*tan(c)^2 + 54*A*a*b^2*d*x*tan(d*x)^2*tan(c)^2 - 18*B*b^3*d*x*tan(d*x)^ 
2*tan(c)^2 + 9*B*a*b^2*tan(d*x)^3*tan(c)^3 + 3*A*b^3*tan(d*x)^3*tan(c)^3 + 
 9*B*a^3*log(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*t 
an(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*tan(d*x)^2*tan(c)^2 + 27*A*a^2*b*log 
(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + ta 
n(d*x)^2 + tan(c)^2 + 1))*tan(d*x)^2*tan(c)^2 - 27*B*a*b^2*log(4*(tan(d*x) 
^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + t 
an(c)^2 + 1))*tan(d*x)^2*tan(c)^2 - 9*A*b^3*log(4*(tan(d*x)^2*tan(c)^2 - 2 
*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*t 
an(d*x)^2*tan(c)^2 - 18*B*a^2*b*tan(d*x)^3*tan(c)^2 - 18*A*a*b^2*tan(d*...
 
3.3.50.9 Mupad [B] (verification not implemented)

Time = 8.27 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.01 \[ \int (a+b \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=x\,\left (A\,a^3-3\,B\,a^2\,b-3\,A\,a\,b^2+B\,b^3\right )-\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (-\frac {B\,a^3}{2}-\frac {3\,A\,a^2\,b}{2}+\frac {3\,B\,a\,b^2}{2}+\frac {A\,b^3}{2}\right )}{d}+\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {A\,b^3}{2}+\frac {3\,B\,a\,b^2}{2}\right )}{d}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,b^3-3\,a\,b\,\left (A\,b+B\,a\right )\right )}{d}+\frac {B\,b^3\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d} \]

input
int((A + B*tan(c + d*x))*(a + b*tan(c + d*x))^3,x)
 
output
x*(A*a^3 + B*b^3 - 3*A*a*b^2 - 3*B*a^2*b) - (log(tan(c + d*x)^2 + 1)*((A*b 
^3)/2 - (B*a^3)/2 - (3*A*a^2*b)/2 + (3*B*a*b^2)/2))/d + (tan(c + d*x)^2*(( 
A*b^3)/2 + (3*B*a*b^2)/2))/d - (tan(c + d*x)*(B*b^3 - 3*a*b*(A*b + B*a)))/ 
d + (B*b^3*tan(c + d*x)^3)/(3*d)